<template>
	<view class="content">
		<view class="advance-area">
			<view class="flex-box tc title">一周食谱表</view>
			<view class="flex-box tc thead">
				<view class="item-3">星期</view>
				<view class="item-3">训练计划与任务</view>
				<view class="item-3">今日菜谱</view>
			</view>
			<block v-for="(planDay,planIndex) in motionDataListData.motionDataList">
				<view class="flex-box table tc" :key="planIndex">
					<view class="item-3">
						{{planDay.week|weekDay}}
					</view>
					<view class="item-3">
						<view class="table-flex">
							<block v-for="(planTime,index) in planDay.motion" :key="index">
								<view class="item">
									<block v-for="(v,k) in planTime.motionList" :key="k">
										{{v.motionType}}
										<block v-if="planTime.motionList.length!=k+1">-</block>
									</block>
								</view>
							</block>
						</view>
					</view>
					<view class="item-3">
						<view class="table-flex">
							<block v-for="(planTime,index) in planDay.motion" :key="index">
								<view class="item">
									<template v-if=" planTime.menuList.length">
										<block v-for="(v,k) in planTime.menuList" :key="k">
											{{v.menuName}}
											<block v-if="planTime.menuList.length!=k+1">-</block>
										</block>
									</template>
									<template v-else>
										暂无菜谱
									</template>
								</view>
							</block>
						</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		props: {
			motionDataListData: {
				type: Object,
				default: {}
			}
		},
		filters: {
			weekDay(val) {
				var weeks = new Array("星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日");
				return weeks[val - 1]
			}
		}
	}
</script>

<style lang="scss" scoped>
	$color:#e0e0e0;

	.content {
		display: flex;
		flex-direction: column;
		background-color: #fbf9fe;
	}

	.flex-box {
		display: flex;
		flex-wrap: wrap;
	}


	.flex-box>.item-2 {
		flex: 0 0 50%;
	}

	.flex-box>.item-3 {
		// flex: 0 0 33.3333%;
		width: 33.3333%;
	}

	.title {
		height: 67upx;
		color: red;
		display: flex;
		justify-content: center;
		align-items: center;
		border-top: 1upx solid $color;
		border-right: 1upx solid $color;
		border-left: 1upx solid $color;
	}

	// 多行合并表格
	.advance-area {
		.item-3 {
			font-size: 26upx;
			border: 1upx solid $color;
			border-width: 1upx 1upx 0 0;
			box-sizing: border-box;
			text-align: center;

			&:first-child {
				border-left-width: 1upx;
			}

			&:last-child {
				border-right-width: 1upx;
			}
		}

		.thead {
			.item-3 {
				font-weight: bold;
				padding: 16upx 10upx;
				box-sizing: border-box;
			}
		}

		.table {
			&:last-child {
				border-bottom: 1upx solid $color;
			}

			.item-3 {
				display: flex;
				justify-content: center;
				align-items: center;
				box-sizing: border-box;
			}
		}

		.table-flex {
			// flex: 1;
			// width: 33.33%;
			width: 100%;

			.item {
				width: 100%;
				padding: 10upx;
				border-bottom: 1upx solid $color;
				height: 160upx;
				box-sizing: border-box;
				overflow: hidden;
				// display: flex;
				// flex-wrap: wrap;
				text-align: left;

				&:last-child {
					border-width: 0;
				}
			}
		}

	}
</style>
